package entity;

public class EQ1616Register extends ENumberRegister {
	private double value = -1.;
	
	public EQ1616Register(String name, int address, String dataType,
			String description, String unit, double min, double max) {
		super(name, address, dataType, description, true, unit, min, max);
	}

	@Override
	public Object getValue() {
		return value;
	}

	@Override
	public void setValue(byte b0, byte b1, byte b2, byte b3) {
		double newValue = ((int) b2 & 0xff) + (((int) b3 & 0xff) << 8) 
				+ (((int) b0 & 0xff) + (((int) b1 & 0xff) << 8))/Math.pow(2,16);
		
		this.value = newValue;
		setChanged();
		notifyObservers(value);
	}
    
    @Override public String toString()
    {
        return String.valueOf(value);
    }

}
